/*
 * Copyright (c) 2010 CCX(China) Co.,Ltd. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * CCX(China) Co.,Ltd. ("Confidential Information").
 * It may not be copied or reproduced in any manner without the express 
 * written permission of CCX(China) Co.,Ltd.
 * 
 *	Created on 2010-12-13 下午05:16:14
 */
package cn.com.ccxe.core.db.util;

import cn.com.ccxe.core.entity.Article;

import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;

public class ArticleTupleBingding extends TupleBinding<Article> {

	@Override
	public Article entryToObject(TupleInput input) {
		Article article = new Article();
		
		article.setModuleId(input.readInt());
		article.setReleaseDate(input.readString());
		article.setUrl(input.readString());
		article.setTitle(input.readString());
		article.setContent(input.readString());
		
		return article;
	}

	@Override
	public void objectToEntry(Article article, TupleOutput output) {
		output.writeInt(article.getModuleId());
		output.writeString(article.getReleaseDate());
		output.writeString(article.getUrl());
		output.writeString(article.getTitle());
		output.writeString(article.getContent());
	}

}
